package com.example.ws_test;

import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class HomeActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_home);

        // 初始化按钮
        Button openMainActivityButton = findViewById(R.id.open_main_activity_button);
        Button openTabbedActivityButton = findViewById(R.id.open_tabbed_activity_button);
        Button handlerExampleButton = findViewById(R.id.handler_example_button);

        // 设置跳转到现有MainActivity的按钮点击事件
        openMainActivityButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(HomeActivity.this, MainActivity.class);
                startActivity(intent);
            }
        });

        // 设置跳转到新的Tab页面的按钮点击事件
        openTabbedActivityButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(HomeActivity.this, TabbedActivity.class);
                startActivity(intent);
            }
        });

        // 设置跳转到Handler示例Activity的按钮点击事件
        handlerExampleButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(HomeActivity.this, HandlerExampleActivity.class);
                startActivity(intent);
            }
        });
    }
}